function a(ele){return document.querySelector(ele)}
function c(ele){return document.createElement(ele)}

//ajax_get
function ajax_get(url){
    return new Promise((resolve,reject)=>{
        let xhr=new XMLHttpRequest()
        xhr.open("get",url,true)
        xhr.send()
        xhr.onreadystatechange=()=>{
            if(xhr.readyState === 4 && xhr.status === 200){
                resolve(xhr.responseText)
            }
        }
    })
}
//ajax_post
function ajax_post(url,str){
    return new Promise((resolve,reject)=>{
        let xhr=new XMLHttpRequest()
        xhr.open("post",url,true)
        xhr.setRequestHeader('content-type','application/x-www-form-urlencoded')
        xhr.send(str)
        xhr.onreadystatechange=()=>{
            if(xhr.readyState === 4 && xhr.status === 200){
                resolve(xhr.responseText)
            }
        }
    })
}

window.onload=()=>{
    ajax_get("./person_get.php").then(result=>{
        let arr=JSON.parse(result)
        fn(arr)
    })
}

function fn(arr){
    for(let i of arr){
        $(".username").children().eq(1).text(i.username)
        $(".pwd").children().eq(1).text(i.pwd)
        $(".phone").children().eq(1).text(i.phone)
    }
}